﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StockImport.http;
using System.IO;
using Utilities;

namespace StockImport.log
{
    public class LogServices
    {
        protected static String logPath = @"d:\stockdata\log\";
        
        public void LogResult(UpdateResult data)
        {
            String ds=DateUtils.toShortDateFormat_NoSlash(data.資料日期);
            String p=String.Format(@"{0}\{1}\{2}\", logPath, data.操作, ds);
            
            String prefix=data.操作 + ds;
            String fileName=FileNameUtils.getValidEmptyFileName(p, prefix, ".xml");
            String path = Path.GetDirectoryName(fileName);
            Directory.CreateDirectory(path);
            SerializeUtils.SaveToXML(fileName, data);
        }


    }
}
